<template>
	<view class="Withdrawal">
		<u-navbar back-icon-color="#FFFFFF" title-color="#FFFFFF" :border-bottom="false"
			:background="{background:'linear-gradient(to right, #0A0A25 30%,#220B4E 60%, #083842 80%)'}"
			:title="i18n.Withdrawal">
		</u-navbar>
		<view class="he2"></view>
		<view class="info">
			<textarea :placeholder="i18n.enteraddress" v-model="address" placeholder-class="ft1" class="t1" />
			<view class="he3"></view>
			<view class="fsb t2">
				<view class="">{{i18n.walcur}}</view>
				<view class="flex aic">
					<image src="@/static/add/KP.png" mode="widthFix" style="width:60rpx"></image>
					<view class="mg-l-10 f42 weight">KR</view>
				</view>
			</view>
			<view class="rel">
				<view class="t3">{{i18n.CurrencyAddress}}</view>
				<input type="number" v-model="id" :placeholder="i18n.enterID" maxlength="14" class="t2" />
			</view>
			<view class="rel">
				<view class="t3">{{i18n.Withdrawalquantity}}</view>
				<input type="number" v-model="money" :placeholder="i18n.enterwithd" maxlength="14" class="t2" />
			</view>
			<view class="rel">
				<view class="t3">{{i18n.Trpassword}}</view>
				<input type="password" v-model="password" :placeholder="i18n.enterpass" maxlength="14" class="t2" />
			</view>
			<view class="btn" @click="submit">{{i18n.Withdrawal}}</view>
		</view>
	</view>
</template>

<script>
	var that
	import {
		_updataTabBar,
		pageto,
		fetch
	} from "../../common/js/sysfun.js"
	import {
		mapGetters,
		mapMutations
	} from 'vuex'

	export default {
		data() {
			return {
				dataList: [],
				address: '',
				money: '',
				id: '',
				password: ''
			}
		},
		onLoad() {

		},
		onShow() {

		},
		computed: {
			i18n() {
				return this.$t('message');
			},
			...mapGetters([
				'getRequestUrl',
				'getLangType',
				'getTextArr',
				'getLoginInfo'
			])
		},
		methods: {
			...mapMutations([
				'setGgsxq',
				'setLoginInfo',
				'setLogin',
				'setLoginTime',
				'setLangType',
				'setAreas'
			]),

			// 获取首页数据
			getData() {
				that.$postAjax('api/Index/index', '', function(res) {
					console.log(res, 'home');
				})
			},
			submit() {
				that = this
				if (!that.address) {
					that.showToast(that.i18n.enteraddress)
					return
				}
				if (!that.id) {
					that.showToast(that.i18n.enterID)
					return
				}
				if (!that.money) {
					that.showToast(that.i18n.enterwithd)
					return
				}
				if (!that.password) {
					that.showToast(that.i18n.enterpass)
					return
				}
				let data = {
					money: that.money,
					address: that.address,
					chain_id: that.id,
					password: that.password
				}
				that.$postAjax('Finance/withdrawal', data, function(res) {
					that.showToast(that.i18n.success)
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/index/index'
						})
					}, 1000)
				})
			},
			showToast(text) {
				uni.showToast({
					title: text,
					icon: 'none'
				});
			},
			pageto(url, pp) {
				console.log(url)
				pageto(url, pp);
			},
		},
		onReachBottom() {

		},
	}
</script>

<style lang="scss" scoped>
	.Withdrawal {
		color: #FFFFFF;
		height: 100vh;
		background-image: url(@/static/add/invite-bg.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;

		.info {
			margin: 0 20rpx;
			padding: 40rpx 40rpx 70rpx;
			border-radius: 40rpx;
			background-color: rgba(81, 95, 140, .5);
			box-shadow: inset -4rpx -4rpx 6rpx 2rpx rgba(81, 95, 140, .5);

			.ft1 {
				color: #FFFFFF;
			}

			.t1 {
				padding: 20rpx;
				height: 140rpx;
				border-radius: 30rpx;
				background-color: #010A38;
			}

			.t2 {
				color: #FFFFFF;
				font-size: 30rpx;
				height: 130rpx;
				margin: 30rpx 0;
				padding: 0 26rpx;
				border-radius: 30rpx;
				background-color: #010A38;
			}

			.t3 {
				position: absolute;
				left: 26rpx;
				line-height: 130rpx;
				font-size: 30rpx;
			}

			/deep/ .uni-input-input {
				text-align: right;
			}

			/deep/ .uni-input-placeholder {
				text-align: right;
			}

			.btn {
				width: 100%;
				height: 100rpx;
				line-height: 100rpx;
				margin-top: 50rpx;
				text-align: center;
				font-size: 32rpx;
				font-weight: bold;
				border-radius: 20rpx;
				background: linear-gradient(to right, #24EEBE, #B22CD8);
			}

		}
	}
</style>